.class public Lcom/netease/newsreader/adapter/HeadAdvertismentAdapter;
.super Landroid/widget/BaseAdapter;
.source "HeadAdvertismentAdapter.java"


# instance fields
.field private mContext:Landroid/content/Context;

.field private mImageDownloader:Lcom/netease/newsreader/util/BaseImageDownloader;

.field private mInflater:Landroid/view/LayoutInflater;

.field private mList:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List",
            "<",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/Object;",
            ">;>;"
        }
    .end annotation
.end field


# direct methods
.method public constructor <init>(Landroid/content/Context;Ljava/util/List;Lcom/netease/newsreader/util/BaseImageDownloader;)V
    .locals 1
    .parameter "context"
    .parameter
    .parameter "imageDownloader"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/content/Context;",
            "Ljava/util/List",
            "<",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/Object;",
            ">;>;",
            "Lcom/netease/newsreader/util/BaseImageDownloader;",
            ")V"
        }
    .end annotation

    .prologue
    .line 30
    .local p2, list:Ljava/util/List;,"Ljava/util/List<Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;>;"
    invoke-direct {p0}, Landroid/widget/BaseAdapter;-><init>()V

    .line 31
    invoke-static {p1}, Landroid/view/LayoutInflater;->from(Landroid/content/Context;)Landroid/view/LayoutInflater;

    move-result-object v0

    iput-object v0, p0, Lcom/netease/newsreader/adapter/HeadAdvertismentAdapter;->mInflater:Landroid/view/LayoutInflater;

    .line 32
    iput-object p1, p0, Lcom/netease/newsreader/adapter/HeadAdvertismentAdapter;->mContext:Landroid/content/Context;

    .line 33
    iput-object p2, p0, Lcom/netease/newsreader/adapter/HeadAdvertismentAdapter;->mList:Ljava/util/List;

    .line 34
    iput-object p3, p0, Lcom/netease/newsreader/adapter/HeadAdvertismentAdapter;->mImageDownloader:Lcom/netease/newsreader/util/BaseImageDownloader;

    .line 35
    return-void
.end method


# virtual methods
.method public getCount()I
    .locals 1

    .prologue
    .line 89
    invoke-virtual {p0}, Lcom/netease/newsreader/adapter/HeadAdvertismentAdapter;->getRealCount()I

    move-result v0

    return v0
.end method

.method public getInitPosition(I)I
    .locals 4
    .parameter "position"

    .prologue
    .line 44
    if-gez p1, :cond_0

    move v2, p1

    .line 57
    :goto_0
    return v2

    .line 48
    :cond_0
    invoke-virtual {p0}, Lcom/netease/newsreader/adapter/HeadAdvertismentAdapter;->getRealCount()I

    move-result v1

    .line 49
    .local v1, realCount:I
    if-gtz v1, :cond_1

    move v2, p1

    .line 50
    goto :goto_0

    .line 53
    :cond_1
    invoke-virtual {p0, p1}, Lcom/netease/newsreader/adapter/HeadAdvertismentAdapter;->getRealPosition(I)I

    move-result p1

    .line 55
    invoke-virtual {p0}, Lcom/netease/newsreader/adapter/HeadAdvertismentAdapter;->getCount()I

    move-result v0

    .line 57
    .local v0, count:I
    div-int/lit8 v2, v0, 0x2

    div-int/lit8 v3, v0, 0x2

    rem-int/2addr v3, v1

    sub-int/2addr v2, v3

    add-int/2addr v2, p1

    goto :goto_0
.end method

.method public getItem(I)Ljava/lang/Object;
    .locals 2
    .parameter "position"

    .prologue
    .line 94
    iget-object v0, p0, Lcom/netease/newsreader/adapter/HeadAdvertismentAdapter;->mList:Ljava/util/List;

    invoke-virtual {p0, p1}, Lcom/netease/newsreader/adapter/HeadAdvertismentAdapter;->getRealPosition(I)I

    move-result v1

    invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    return-object v0
.end method

.method public getItemId(I)J
    .locals 2
    .parameter "position"

    .prologue
    .line 99
    invoke-virtual {p0, p1}, Lcom/netease/newsreader/adapter/HeadAdvertismentAdapter;->getRealPosition(I)I

    move-result v0

    int-to-long v0, v0

    return-wide v0
.end method

.method public getRealCount()I
    .locals 1

    .prologue
    .line 84
    iget-object v0, p0, Lcom/netease/newsreader/adapter/HeadAdvertismentAdapter;->mList:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    if-nez v0, :cond_0

    const/4 v0, 0x0

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x3

    goto :goto_0
.end method

.method public getRealPosition(I)I
    .locals 1
    .parameter "position"

    .prologue
    .line 67
    if-gez p1, :cond_1

    .line 74
    .end local p1
    :cond_0
    :goto_0
    return p1

    .line 70
    .restart local p1
    :cond_1
    invoke-virtual {p0}, Lcom/netease/newsreader/adapter/HeadAdvertismentAdapter;->getRealCount()I

    move-result v0

    .line 71
    .local v0, realCount:I
    if-lez v0, :cond_0

    .line 74
    rem-int/2addr p1, v0

    goto :goto_0
.end method

.method public getView(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View;
    .locals 7
    .parameter "position"
    .parameter "convertView"
    .parameter "viewparent"

    .prologue
    const/4 v3, 0x0

    const/4 v6, -0x1

    .line 104
    invoke-virtual {p0, p1}, Lcom/netease/newsreader/adapter/HeadAdvertismentAdapter;->getRealPosition(I)I

    move-result p1

    .line 105
    invoke-virtual {p0}, Lcom/netease/newsreader/adapter/HeadAdvertismentAdapter;->getRealCount()I

    move-result v4

    if-nez v4, :cond_0

    .line 138
    :goto_0
    return-object v3

    .line 109
    :cond_0
    if-nez p2, :cond_1

    .line 110
    iget-object v4, p0, Lcom/netease/newsreader/adapter/HeadAdvertismentAdapter;->mInflater:Landroid/view/LayoutInflater;

    const v5, 0x7f030029

    invoke-virtual {v4, v5, v3}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object p2

    .line 112
    new-instance v3, Landroid/widget/Gallery$LayoutParams;

    .line 113
    invoke-direct {v3, v6, v6}, Landroid/widget/Gallery$LayoutParams;-><init>(II)V

    .line 112
    invoke-virtual {p2, v3}, Landroid/view/View;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    .line 116
    :cond_1
    iget-object v3, p0, Lcom/netease/newsreader/adapter/HeadAdvertismentAdapter;->mList:Ljava/util/List;

    invoke-interface {v3, p1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Ljava/util/Map;

    .local v2, map:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
    move-object v0, p2

    .line 117
    check-cast v0, Landroid/widget/ImageView;

    .line 119
    .local v0, imageView:Landroid/widget/ImageView;
    const-string v3, "imgsrc"

    invoke-interface {v2, v3}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/String;

    .line 122
    .local v1, imgsrc:Ljava/lang/String;
    iget-object v3, p0, Lcom/netease/newsreader/adapter/HeadAdvertismentAdapter;->mImageDownloader:Lcom/netease/newsreader/util/BaseImageDownloader;

    invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;

    move-result-object v4

    invoke-virtual {v3, v4}, Lcom/netease/newsreader/util/BaseImageDownloader;->setThread(Ljava/lang/Thread;)V

    .line 123
    iget-object v3, p0, Lcom/netease/newsreader/adapter/HeadAdvertismentAdapter;->mImageDownloader:Lcom/netease/newsreader/util/BaseImageDownloader;

    invoke-virtual {v3, v1, v0}, Lcom/netease/newsreader/util/BaseImageDownloader;->download(Ljava/lang/String;Landroid/widget/ImageView;)V

    move-object v3, p2

    .line 138
    goto :goto_0
.end method
